<template>
  <div class="dashboard">
    <el-card class="welcome-card">
      <template #header>
        <div class="card-header">
          <span>欢迎使用</span>
        </div>
      </template>
      <div class="dashboard-content">
        <h2>系统概览</h2>
        <el-row :gutter="20">
          <el-col :xs="24" :sm="12" :md="6">
            <el-card shadow="hover" class="data-card">
              <h3>用户总数</h3>
              <div class="number">{{ userCount }}</div>
            </el-card>
          </el-col>
          <el-col :xs="24" :sm="12" :md="6">
            <el-card shadow="hover" class="data-card">
              <h3>在线用户</h3>
              <div class="number">{{ onlineUsers }}</div>
            </el-card>
          </el-col>
        </el-row>
      </div>
    </el-card>
  </div>
</template>

<script setup lang="ts">
import { ref, onMounted } from 'vue'

const userCount = ref(0)
const onlineUsers = ref(0)

onMounted(async () => {
  // 这里可以添加获取数据的API调用
  userCount.value = 100
  onlineUsers.value = 10
})
</script>

<style scoped>
.dashboard {
  padding: 20px;
}

.welcome-card {
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dashboard-content {
  padding: 20px 0;
}

.data-card {
  text-align: center;
  margin-bottom: 20px;
}

.data-card h3 {
  color: #606266;
  font-size: 16px;
  margin-bottom: 10px;
}

.number {
  font-size: 24px;
  color: #409EFF;
  font-weight: bold;
}

/* 移动端适配 */
@media screen and (max-width: 768px) {
  .dashboard {
    padding: 10px;
  }
  
  .data-card {
    margin-bottom: 10px;
  }
  
  .number {
    font-size: 20px;
  }
}
</style> 